package com.example.hotel.utils;

import com.example.hotel.entity.ResultModel;

import java.util.UUID;

/**
 * 通用工具类
 */


public class CommonUtils {

    /**
     * 自定义
     * 文件上传路径和资源访问URL
     */
    public static final String PATH = "upload/psycho/";

    /**
     * 通用字符
     */
    public static final String INSERTSUCCESS = "添加成功";
    public static final String INSERTFAIL = "添加失败";
    public static final String SELECTSUCCESS = "查询成功";
    public static final String SELECTFAIL = "查询失败";
    public static final String UPDATESUCCESS = "修改成功";
    public static final String UPDATEFAIL = "修改失败";
    public static final String DELETESUCCESS = "删除成功";
    public static final String DELETEFAIL = "删除失败";
    public static final String EXISTEDUSER = "该用户已存在";
    public static final String REGISTERSUCCESS = "注册成功";
    public static final String REGISTERFAIL = "注册成功";
    public static final String LOGINFAIL = "登录失败";
    public static final String UPLOADSUCCESS = "上传成功";
    public static final String UPLOADFAIL = "上传失败";
    public static final Integer CODEONE = 1;//成功标记
    public static final Integer CODETWO = 2;//已存在标记
    public static final Integer CODEMINUSONE = -1;//失败标记


    /**
     * 结果返回 通用工具类
     * @param resultModel  实体类
     * @param code  返回的编码
     * @param msg   返回的消息
     * @param data  返回的数据
     */
    public static void ResultShow(ResultModel resultModel, int code, String msg, Object data){
        resultModel.setCode(code);
        resultModel.setMsg(msg);
        resultModel.setData(data);
    }

    /**
     * 随机生成图片/视频ID
     * @return UUID 生成不重复的ID
     */
    public static String generateGUID() {
        return UUID.randomUUID().toString().replace("-", "");
    }

}
